package models

import (
	"github.com/astaxie/beego/orm"
)

type TargetDomain struct {
	Id            int64
	DomainId      string `orm:"size(10);index"`
	UniprotKb     string `orm:"size(20)"`
	FeatureKey    string `orm:"size(50)"`
	StartPosition int64
	Length        int64
	Description   string `orm:"size(256)"`
}

func (m *TargetDomain) TableName() string {
	return "targetdomain"
}

func (m *TargetDomain) Insert() error {
	if _, err := orm.NewOrm().Insert(m); err != nil {
		return err
	}
	return nil
}

func (m *TargetDomain) Read(fields ...string) error {
	if err := orm.NewOrm().Read(m, fields...); err != nil {
		return err
	}
	return nil
}

func (m *TargetDomain) Update(fields ...string) error {
	if _, err := orm.NewOrm().Update(m, fields...); err != nil {
		return err
	}
	return nil
}

func (m *TargetDomain) Delete() error {
	if _, err := orm.NewOrm().Delete(m); err != nil {
		return err
	}
	return nil
}

func (m *TargetDomain) Query() orm.QuerySeter {
	return orm.NewOrm().QueryTable(m)
}
